package com.deer.wms.inventory.model.Inventory;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.deer.wms.project.root.annotaiton.MyAnnotation;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

/**
 * @author guo
 */
@Getter
@Setter
public class Inventory {
    @Id
    @TableId(type = IdType.AUTO)
    @Column(name = "inventory_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer inventoryId;

    /**
     * 仓库ID
     */
    @Column(name = "ware_id")
    private Integer wareId;

    /**
     * 仓库名称
     */
    @Column(name = "ware_name")
    private String wareName;

    /**
     * 货主ID
     */
    @Column(name = "organization_id")
    private Integer organizationId;

    /**
     * 货主名称
     */
    @Column(name = "organization_name")
    private String organizationName;

    /**
     * 物料编码
     */
    @Column(name = "item_code")
    @MyAnnotation(columnIndex = 4)
    private String itemCode;
    private String spec;
    private String model;
    private String imgUrl;
    private Integer baoKuan;

    /**
     * 物料名称
     */
    @Column(name = "item_name")
    @MyAnnotation(columnIndex = 5)
    private String itemName;

    /**
     * 批次ID
     */
    @Column(name = "batch_id")
    private Integer batchId;

    /**
     * 批次名称
     */
    @MyAnnotation(columnIndex = 8)
    @Column(name = "batch_name")
    private String batchName;


    /**
     * 货位编码
     */
    @Column(name = "cell_code")
    private String cellCode;

    /**
     * 追踪号
     */
    @Column(name = "box_code")
    private String boxCode;

    /**
     * LPN号码
     */
    private String lpn;

    /**
     * 单位
     */
    @Column(name = "pack_detail_id")
    private Integer packDetailId;

    /**
     * 单位
     */
    @Column(name = "pack_describe")
    private String packDescribe;

    /**
     * 数量
     */

    @MyAnnotation(columnIndex = 7)
    private Double quantity;

    public Double getQuantity() {
        return ObjectUtil.isNotEmpty(quantity) ? quantity : 0;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

    /**
     * 分配数量
     */
    @Column(name = "allot_quantity")
    private Double allotQuantity;

    public Double getAllotQuantity() {
      return ObjectUtil.isNotEmpty(allotQuantity) ? allotQuantity : 0.00;
    }

    /**
     * 冻结数量
     */
    @Column(name = "freeze_quantity")
    private Double freezeQuantity;

    private Integer state;

    /**
     * 状态描述，主要用于冻结状态的描述
     */
    private String stateDis;

    private Integer qcState;

    private Double transRatio;

    private Integer allotPackDetailId;
    private String allotPackDescribe;
    private Double allotTransRatio;
    private Integer freezePackDetailId;
    private String freezePackDescribe;
    private Double freezeTransRatio;

    /**
     * 关联的单据 记录绑定的出库信息（SO单据号  或者  波次明细号）
     */
    private String billNo;

    @MyAnnotation(columnIndex = 0)
    private Integer erpAreaId;
    @MyAnnotation(columnIndex = 3)
    private Integer erpItemId;
    //入库仓库id
    private Integer asnStockId;
    //入库仓库名称
    private String asnStockName;
    //批号编码
    private String lotCode;
    //差异数量
    private Double diffQty;
    //库位编码
    private String containerCode;
    //入库时间(有效期管理)
    @Column(name = "accept_time")
    private String acceptTime;

}
